package com.hctforgreen.greenservice.model;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 学习资料实体类（学习资料列表及学习资料详情）
 *
 * @author denghb
 */
public class StudyEntity extends BaseEntity {

    private static final long serialVersionUID = 7084740916307013863L;
    public String id = "";
    public String bookId = ""; // 关联资料的id
    public String videoName = "";// 关联视频名称
    public String date = "";// 发布时间
    public String downloads = "";// 下载量
    public String msg = "";// 消息
    public String content = "";// 内容
    public String statusCode = "";
    public String title = "";// 标题
    public String studyTypeId;// 类别id
    public String seriesName = "";// 系列名称
    public String praises = "";// 点赞量
    public String videoId = "";// 关联视频id
    public String examId = "";// 关联试卷的id
    public String examName = "";// 试卷名称
    public String examStatus = "";//考试的状态
    public String studyTypeName = "";// 学习资料类别名称
    public String seriesId = "";// 些列id
    public String bookName = "";// 关联资料的名称
    public String studydataList = "";//学习资料列表

    /**
     * 2016.11.18  390778
     * 增加点踩属性、
     * 用户是否对该资料进行过点赞操作
     */
    public String step = ""; //踩
    public String evaluate = "";//是否进行过点击操作


    public boolean isSelected = false;

    public static StudyEntity parse(JSONObject jsonObject) throws JSONException {
        StudyEntity studyEntity = new StudyEntity();

        if (jsonObject == null) {
            return studyEntity;
        }
        if (jsonObject.has("id")) {
            studyEntity.id = jsonObject.getString("id");
        }
        if (jsonObject.has("bookId")) {
            studyEntity.bookId = jsonObject.getString("bookId");
        }
        if (jsonObject.has("videoName")) {
            studyEntity.videoName = jsonObject.getString("videoName");
        }
        if (jsonObject.has("date")) {
            studyEntity.date = jsonObject.getString("date");
        }
        if (jsonObject.has("downloads")) {
            studyEntity.downloads = jsonObject.getString("downloads");
        }
        if (jsonObject.has("msg")) {
            studyEntity.msg = jsonObject.getString("msg");
        }
        if (jsonObject.has("content")) {
            studyEntity.content = jsonObject.getString("content");
        }
        if (jsonObject.has("statusCode")) {
            studyEntity.statusCode = jsonObject.getString("statusCode");
        }
        if (jsonObject.has("title")) {
            studyEntity.title = jsonObject.getString("title");
        }
        if (jsonObject.has("studyTypeId")) {
            studyEntity.studyTypeId = jsonObject.getString("studyTypeId");
        }
        if (jsonObject.has("seriesName")) {
            studyEntity.seriesName = jsonObject.getString("seriesName");
        }
        if (jsonObject.has("praises")) {
            studyEntity.praises = jsonObject.getString("praises");
        }
        if (jsonObject.has("videoId")) {
            studyEntity.videoId = jsonObject.getString("videoId");
        }
        if (jsonObject.has("examId")) {
            studyEntity.examId = jsonObject.getString("examId");
        }
        if (jsonObject.has("examName")) {
            studyEntity.examName = jsonObject.getString("examName");
        }
        if (jsonObject.has("examStatus")) {
            studyEntity.examStatus = jsonObject.getString("examStatus");
        }
        if (jsonObject.has("studyTypeName")) {
            studyEntity.studyTypeName = jsonObject.getString("studyTypeName");
        }
        if (jsonObject.has("seriesId")) {
            studyEntity.seriesId = jsonObject.getString("seriesId");
        }
        if (jsonObject.has("bookName")) {
            studyEntity.bookName = jsonObject.getString("bookName");
        }

        if (jsonObject.has("step")) {
            studyEntity.step = jsonObject.getString("step");
        }
        if (jsonObject.has("evaluate")) {
            studyEntity.evaluate = jsonObject.getString("evaluate");
        }
        if (jsonObject.has("studydataList")) {
            studyEntity.studydataList = jsonObject.getString("studydataList");
        }

        return studyEntity;
    }


    public String getEvaluate() {
        return evaluate;
    }

    public void setEvaluate(String evaluate) {
        this.evaluate = evaluate;
    }

    public String getPraises() {
        return praises;
    }

    public void setPraises(String praises) {
        this.praises = praises;
    }

    public String getStep() {
        return step;
    }

    public void setStep(String step) {
        this.step = step;
    }

    public String getExamStatus() {
        return examStatus;
    }


    @Override
    public String toString() {
        return "StudyEntity{" +
                "id='" + id + '\'' +
                ", bookId='" + bookId + '\'' +
                ", videoName='" + videoName + '\'' +
                ", date='" + date + '\'' +
                ", downloads='" + downloads + '\'' +
                ", msg='" + msg + '\'' +
                ", content='" + content + '\'' +
                ", statusCode='" + statusCode + '\'' +
                ", title='" + title + '\'' +
                ", studyTypeId='" + studyTypeId + '\'' +
                ", seriesName='" + seriesName + '\'' +
                ", praises='" + praises + '\'' +
                ", videoId='" + videoId + '\'' +
                ", examId='" + examId + '\'' +
                ", examName='" + examName + '\'' +
                ", examStatus='" + examStatus + '\'' +
                ", studyTypeName='" + studyTypeName + '\'' +
                ", seriesId='" + seriesId + '\'' +
                ", bookName='" + bookName + '\'' +
                ", step='" + step + '\'' +
                ", evaluate='" + evaluate + '\'' +
                ", isSelected=" + isSelected +
                ", studydataList=" + studydataList +
                '}';
    }
}
